const tableOption = {
    border: true,
    card: true,
    index: true,
    indexLabel: '序号',
    stripe: true,
    menu: true,
    menuAlign: 'center',
    filterBtn: false,
    menuWidth: 300,
    align: 'center',
    viewBtn: false,
    editBtn: false,
    delBtn: false,
    addBtn: false,
    searchMenuSpan: 6,
    dialogWidth: '85%',
    labelWidth: 130,
    dialogHeight: '78%',
    column: [

        {
            label: '订单号',
            prop: 'originalNo',
            search: true,
            placeholder: '订单号',
            rules: [{
                required: true,
                message: '请输入订单号',
                trigger: 'blur'
            }],
            editDisabled: true
        },
        {
            label: '支付单号',
            prop: 'tid',
            search: true,
            rules:
                [{
                    required: true,
                    message: '请输入支付单号',
                    trigger: 'blur'
                }],
            editDisabled: true

        },
        {
            label: '交易单号',
            prop: 'tradeNo',
            search: false,
            editDisabled: true

        },
        {
            label: '金额',
            prop: 'money',
            search: false,
            editDisabled: true

        },
        {
            label: '支付渠道',
            prop: 'companay',
            search: false,
            editDisabled: false

        },
        {
            label: '状态',
            prop: 'stateName',
            search: true,
            hide: true,
            editDisabled: false

        }
    ]
}
const vm = new Vue({
    el: '#app',
    name: 'spiderStock',
    data() {
        return {
            form: {},
            seachKey: '',
            cronPopover: false,
            queryParams: {}, // 全局检索条件
            tableData: [],
            dialogFormVisible: false,
            jobId: '',
            page: {
                total: 10, // 总页数
                currentPage: 1, // 当前页数
                pageSize: 10 // 每页显示多少条,
            },
            tableLoading: false,
            tableOption: tableOption,
            dialogFormVisible: false,
            content: null
        }
    },
    watch:{

    },
    computed: {


    },
    mounted: function () {
        this.getList();
    },
    methods: {
        getList() {
            let that = this
            this.tableLoading = true
            axios.post('/pay/list',Object.assign(this.queryParams)).then(response => {
                console.log(response)
                if(response.data.code ===0){
                    if(response.data.body.list&&Object.keys(response.data.body.list).length>0){
                        console.log("----承受多大的深刻的思考---")
                        this.tableData = response.data.body.list
                        this.page.total = response.data.body.total
                    }else{
                        this.$notify.info("无查询结果！")
                    }
                }else{
                    this.$notify.error(response.data.msg)
                }

            }).finally(()=>{
                this.tableLoading = false
            })
        },
        seachBykey() {
            if(  this.seachKey==null || this.seachKey.length ===0){
                this.$notify.error("搜索内容不能为空！")
                return
            }
            let that = this
            this.tableLoading = true
            axios.post('/stockHq/getByKey',{
                key: that.seachKey
            }).then(response => {
                if(response.data.code ===200){
                    if(response.data.data&&Object.keys(response.data.data)>0){
                        this.tableData = [response.data.data]
                        this.page.total = 1
                    }else{
                        this.$notify.info("无查询结果！")
                    }
                }else{
                    this.$notify.error(response.data.msg)
                }

            }).finally(()=>{
                this.tableLoading = false
            })
        },
        init() {
            this.dialogFormVisible = true;

        },
        /**
         * 新增定时任务持久化处理
         */
        save(row, done, loading) {
            const that = this
            axios.post('/stockHq/query',row)
            .then((rs) => {
                const result = response.data.code
                if (result !== 200) {
                    debugger
                    that.$notify.error(response.data.msg)
                }else{
                    that.$notify.success('查询成功')
                    this.getList(this.page)
                    done()
                }

            }).catch(() => {
                loading()
            })
        },
        /**
         * 清除全局检索条件
         */
        handleSearchReset() {
            this.queryParams = {}
        },
        /**
         * 定时任务检索查询分页查询
         */
        handleContent(row, done) {
            this.dialogFormVisible = true
            this.content = JSON.stringify(row)
        },
        /**
         * 执行定时任务
         */
        doRefund(row) {


        },
        handleAdd() {
            this.$refs.crud.rowAdd()
        },
        handleUpdate(row, index) {

        },
        /**
         * 暂停定时任务
         */
        handleShutDownJob(row) {

        },
        /**
         * 刷新回调
         */
        refreshChange() {
            this.getList(this.page)
        },
        sizeChange(pageSize){
            this.page.pageSize = pageSize
        },
        currentChange(current){
            this.page.currentPage = current
        },
        closeJobLogDialog() {
            this.dialogFormVisible = false
            // this.pageLog.total = 0;
            // this.pageLog.currentPage = 1;
            // this.pageLog.pageSize = 10;
        }
    }
});